import React from 'react'
import {  columnRenders } from '@/lib'
import { settledReviewstatusEnum } from '../../List'
import dayjs from 'dayjs'
import TodoTable from '../../component/Table'

export default class Index extends TodoTable {
  constructor(props) {
    super(props)
    this.state = {
      columns: [
        ["序号", "id", (text, record, index) => index + 1],
        ["客户编码", "agentCode"],
        ["客户名称", "agentName"],
        ["任务状态", "approvalStatus", (text) => settledReviewstatusEnum[text]],
        ["提交时间", "createdTime", (text)=>text&&dayjs(text).format('YYYY-MM-DD HH:mm:ss')],
        {
          title: "操作",
          dataIndex: 'operate',
          width: 100,
          render: columnRenders.operate([
            {
              title: "查看详情",
              auth: 'my_backlog_registerBacklog_detail',
              action: (text, model, index) => this.goDetail(model)
            },
          ])
        },
      ],
      tableProps: {},
    }
  }

  private goDetail = (model) => {
    const { taskDefId } = model
    const { todoType, brandCode } = this.props
    this.props.history.push('/todo/settledreview/detail/' + model.id + '?taskId=' + taskDefId + '&type=' + todoType+ '&brandCode=' + brandCode)
  }
}
